<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'modifyPasswordPage.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link href="assets/ico/bioroad-logo.ico" rel="shortcut icon">
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-collapse.js"></script>
<script type="text/javascript" src="js/bootstrap-tab.js"></script>
<style type="text/css">
body {
	
}

input {
	text-align: left;
}
</style>
</head>

<body>
	<hr />
	<img alt="" src="img/baolude-logo.gif">
	<hr />
	请输入原来的密码：
	<input type="password" name="oldPassword" onblur="verifypassword()" />
	<img class="imgTishi" alt="" src="">
	<span class="tishi1" style="color: red;"></span>
	<br /> 请输入新密码：
	<input type="password" name="newPassword" />
	<br /> 确认新密码：
	<input type="password" name="secoundNewPassword"
		onblur="varifyNewPassword()" />
	<span class="tishi2"></span>
	<br />
	<a class="btn btn-success"> <i class="icon-ok icon-white"></i> 确认修改
	</a>
</body>
<script type="text/javascript">
	$(function() {
		$(".btn-success").click(function() {
			//alert("xxx");
			$.post("saveNewPassword.action", {"newPassword" : $("input[name='newPassword']").val()}, function(data) {
				if(data){
					alert("修改成功，请重新登录！");
					window.location.reload();
					//$.post("app.action");
				}
			});
			/*if ($("input[name='secoundNewPassword']").val() == $(
					"input[name='newPassword']").val()) {*/

			//}
			$.post("varifyPassword1.action", {
				"oldPassword" : $("input[name='oldPassword']").val()
			}, function(data) {
				if (data) {
					$("img[class='imgTishi']").attr("src", "img/ok.png");
					/*$(".tishi1").text("√");
					$(".tishi1").css("color","green");
					$(".tishi1").css("font-size","20px");
					$(".tishi1").css("font-family","nomal");*/

				} else {
					$(".tishi1").text("您输入的原密码有误，请重新输入！");
					$("input[name='oldPassword']").attr("value", "");
				}
			});
		});
	});

	$(function() {
		$("input[name='oldPassword']").click(function() {
			$(".tishi1").text("");
			$("img[class='imgTishi']").attr("src", "");
		});
		$("input[name='oldPassword']").focus(function() {
			$(".tishi1").text("");
			$("img[class='imgTishi']").attr("src", "");
		});

		$("input[name='secoundNewPassword']").click(function() {
			$(".tishi2").text("");
		});
		$("input[name='secoundNewPassword']").focus(function() {
			$(".tishi2").text("");
		});

	});
	function varifyNewPassword() {
		if ($("input[name='secoundNewPassword']").val() != $(
				"input[name='newPassword']").val()) {
			$(".tishi2").text("您两次输入的密码不一致，请重新输入！");
			$(".tishi2").css("color", "red");
			$(".tishi2").css("color", "red");
			$("input[name='secoundNewPassword']").val("");
		}
	}

	function verifypassword() {
		if ($("input[name='oldPassword']").val() == "") {
			$(".tishi1").text("请输入原来的密码!!!!!!!!");
			return false;
		}
		$.post("varifyPassword1.action", {
			"oldPassword" : $("input[name='oldPassword']").val()
		}, function(data) {
			if (data) {
				$("img[class='imgTishi']").attr("src", "img/ok.png");
				/*$(".tishi1").text("√");
				$(".tishi1").css("color","green");
				$(".tishi1").css("font-size","20px");
				$(".tishi1").css("font-family","nomal");*/

			} else {
				$(".tishi1").text("您输入的原密码有误，请重新输入！");
				$("input[name='oldPassword']").attr("value", "");
			}
		});
	}
	$("input[name='oldPassword']").focus();
</script>
</html>
